<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/5/21
  Time: 22:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改功能</title>
</head>
<body>
<div style="border: 1px solid #E6E6E6;width: 350px;margin:auto;">
    <form id="editFuncForm" style="margin-top: 20px;font-size: 15px;font-family: 微软雅黑;">
        <input type="hidden" name="id">
        <div style="margin-bottom:20px;text-align: center;">
            <input class="easyui-textbox" name="name" data-options="label:'功能名称',width:300,height:30,required:true,missingMessage:'功能名称不能为空！'">
        </div>
        <div style="margin-bottom:20px;text-align: center;">
            <input id="app_comb_edit2" name="application_id">
        </div>
        <div style="margin-bottom:20px;text-align: center;">
            <input id="module_comb_edit" name="module_id">
        </div>
    </form>
    <div style="text-align:center;padding:5px 0">
        <a class="easyui-linkbutton" onclick="$('#editFuncForm').form('submit');" style="width:80px">提交</a>
        <a class="easyui-linkbutton" onclick="$('#editFuncForm').form('clear');" style="width:80px">重置</a>
    </div>
</div>
<script>
    $(function () {
        $('#editFuncForm').form({
            url:'../func/updateFunc',
            type:'post',
            success:function(data){
                var data = eval('(' + data + ')');
                if (data.result === 'success') {
                    $('#editFuncForm').form('clear');
                }
                $.messager.alert('提示', data.message, 'info');
            }
        });

        $('#module_comb_edit').combobox({
            valueField:'id',
            textField:'name',
            label:'所属模块',
            width:300,
            height:30,
            editable:false,
            required:true,
            missingMessage:'所属模块不能为空！'
        });

        $('#app_comb_edit2').combobox({
            url:'../application/findAppForComb',
            valueField:'id',
            textField:'text',
            label:'所属应用',
            width:300,
            height:30,
            editable:false,
            required:true,
            missingMessage:'所属应用不能为空！',
            onSelect: function(rec){
                var url = '../funcModule/findFuncModuleByAppId?app_id='+rec.id;
                $('#module_comb_edit').combobox('reload', url);
            }
        });

        var row = $('#func_dg').datagrid('getSelected');
        $('#editFuncForm').form('load', row);
        //$('#app_comb_edit2').combobox('select', row.application_id);
    });
</script>
</body>
</html>
